* When is a Reminder enough? 
* 1. ITT-Regressions: Table 3 (and on-line appendix A)
* Immigrants
* IMMIGRANTS: First time voters
reg voted i.smseksp if foreignfirst==1 							
margins smseksp 

* IMMIGRANTS: OTHER
reg voted i.smseksp if minusnewtagny==1							
margins smseksp 

* NORWEGIANS: UNDER 30  
reg voted i.smseksp if typeny==3 & under30==1					
margins smseksp 

* NORWEGIANS: OLDER THAN 30
reg voted i.smseksp if typeny==3 & under30==0					
margins smseksp 

* 2. ITT-REGRESSION ADDING CONTROLS: Table 3 (And Online Appendix C) 		
* IMMIGRANTS: FIRST TIME VOTERS

reg voted i.smseksp i.mann c.alder##c.alder i. gift i.western c.botid_grouped ///
i.oslo i.norsk if foreignfirst==1 	

* IMMIGNRANTS: OTHER
reg voted i.smseksp i.mann c.alder##c.alder i. gift i.western c.botid ///
i.oslo i.norsk  if minusnewtagny==1								

* LOWER N DUE TO MISSING ON TIME LIVED IN NORWAY (BOTID)

* NOWEGIANSN: UNDER 30 
reg voted i.smseksp i.mann c.alder##c.alder i. gift i.oslo if typeny==3 & under30==1 

* NORWEGIANS: OLDER THAN 30
reg voted i.smseksp i.mann c.alder##c.alder i. gift i.oslo if typeny==3 & under30==0	

* 3. CACE: REGRESSIONS
* IMMIGRANTS: FIRST TIME VOTERS
ivregress 2sls voted (i.smskontakt=i.smseksp) if foreignfirst==1 		

* IMMIGNRANTS: OTHER
ivregress 2sls voted (i.smskontakt=i.smseksp) if minusnewtagny==1			

* NOWEGIANSN: UNDER 30
ivregress 2sls voted (i.smskontakt=i.smseksp) if typeny==3	& under30==1 				

* NORWEGIANS: OLDER THAN 30
ivregress 2sls voted (i.smskontakt=i.smseksp) if typeny==3	& under30==0 				

* 4. IPW: Inverse-probability-weights (IPW): On-Line Appendix B
* A) IMMIGRANTS: FIRST TIME VOTERS
teffects ipw (voted) (smseksp no_in_house_grouped)if foreignfirst==1, aequations nolog vsquish control(0) 
* ATE: 3.3 (Close to the bivariate regressio)

* B) Other Immigrants 
teffects ipw (voted) (smseksp no_in_house_grouped)if minusnewtagny==1, aequations nolog vsquish control(0)

* ATE: 2.7 (Identical to the bivariate regression)

* C) Under 30 years of age
teffects ipw (voted) (smseksp no_in_house_grouped) if typeny==3 & under30==1, aequations nolog vsquish control(0)

* ATE: 4.6% - (Again, identical result) 

* D) Over 30 years of age
teffects ipw (voted) (smseksp no_in_house_grouped) if typeny==3 & under30==0, aequations nolog vsquish control(0)

* ATE: 1.1 (Again, identical results) 

* DOES TIME MATTER?
* Day of delivery
* Immigrants
reg stemt100 i.dayvoted if foreignfirst==1, vce (cluster komnr)
estimates store first
reg stemt100 i.dayvoted if minusnewtagny==1, vce(cluster komnr)
estimates store second
* Figure 1A
coefplot first || second, drop(_cons) mlabel format(%9.3g) mlabposition (12) msymbol(i) cismoot grid(none) ///
xtitle(Percentage Points) xline(0) scheme(s2color) 

* Day of delivery
* Norwegians
reg stemt100 i.dayvoted if typeny==3 & under30==1
estimates store under30
reg stemt100 i.dayvoted if typeny==3 & under30==0
estimates store over30
* Figure 1B
coefplot under30 || over30, drop(_cons) mlabel format(%9.3g) mlabposition (12) msymbol(i) cismoot grid(none) ///
xtitle(Percentage Points) xline(0) scheme(s2color) 

* Election day: Time of delivery
* Immigrants
reg stemt100 i.timestemt if foreignfirst==1
estimates store first1
reg stemt100 i.timestemt if minusnewtagny==1
estimates store second2

* Figur 2A
coefplot first1 || second2, drop(_cons) mlabel format(%9.3g) mlabposition (12) msymbol(i) cismoot grid(none) ///
xtitle(Percentage Points) xline(0) scheme(s2color) 

* Norwegians
* Norwegians
reg stemt100 i.timestemt if typeny==3 & under30==1
estimates store under301
reg stemt100 i.timestemt if typeny==3 & under30==0
estimates store over302
* Figure 1B
coefplot under301 || over302, drop(_cons) mlabel format(%9.3g) mlabposition (12) msymbol(i) cismoot grid(none) ///
xtitle(Percentage Points) xline(0) scheme(s2color) 












* Election day: Time of delivery
reg stemt100 i.timestemt if foreignfirst==1
estimates store first1
reg stemt100 i.timestemt if minusnewtagny==1
estimates store second2
* Constructing the graph
coefplot first1 || second2, drop(_cons) mlabel format(%9.3g) mlabposition (12) msymbol(i) cismoot grid(none) ///
xtitle(Percentage Points) xline(0) scheme(s2color) // Denne er fin!

